<template>
	<view>
		<!-- <u-popup :show="show" mode="center" @close="show=false" closeable bgColor="transparent"> -->
			<view class="complaint">
				<view class="title">投诉</view>
				<view>
					<u-radio-group v-model="queryParams.type" placement="column" shape>
						<u-radio :customStyle="{marginBottom: '24px'}" v-for="(item, index) in systemData.complaint_item" :key="index"
							:label="item.name" :name="item.id">
						</u-radio>
					</u-radio-group>
					<u--textarea v-model="queryParams.content" placeholder="请输入投诉内容"></u--textarea>
				</view>
				<view class="f jc-s-b btn">
					<view><u-button :plain="true" text="取消" shape="circle" @click="handleCancel"></u-button></view>
					<view><u-button type="primary" text="确定" shape="circle" @click="handleSubmit"></u-button> </view>
				</view>
				<view class="tip">{{systemData.complaint_text||''}}</view>
			</view>
		<!-- </u-popup> -->
	</view>
</template>

<script>
	import {complaint} from '@/api/index.js'
	export default {
		data() {
			return {
				show: false,
				// list: [{
				// 		name: '未经授权使用我的资料',
				// 		disabled: false,
				// 		value:1
				// 	},
				// 	{
				// 		name: '未经授权使用他人资料',
				// 		disabled: false,
				// 		value:2
				// 	},
				// 	{
				// 		name: '其他',
				// 		disabled: false,
				// 		value:3
				// 	}
				// ],				
				queryParams:{
					database_id:'',
					content:'',
					type:''
				}
			}
		},
		onLoad(options) {
			this.queryParams.database_id=options.id
		},
		computed: {
			systemData() {
				return this.$store.state.systemData
			}
		},
		methods: {
			async handleSubmit(){
				if(!this.queryParams.type){
					uni.showToast({
						title:'请选择投诉类型',
						icon:'none'
					})
					return
				}
				await complaint(this.queryParams)
				uni.showToast({
					title:'提交成功',
					icon:'none'
				})
				this.show = false
			},
			handleCancel(){
				uni.navigateBack()
			},
			// setPopup(id) {
			// 	this.queryParams.database_id=id
			// 	this.show = true
			// }
		}
	}
</script>

<style scoped lang="scss">
	.complaint {
		width: 700rpx;
		height: 700rpx;
		background: #fff;
		border-radius: 24rpx;
		padding: 32rpx;
		box-sizing: border-box;
		.tip{
			text-align: center;
			font-size: 26rpx;
			color: #666;
			margin-top: 200rpx;
		}

		.title {
			font-size: 30rpx;
			font-weight: 800;
			text-align: center;
			margin-bottom: 32rpx;
		}

		.btn {
			padding: 0 48rpx;
			box-sizing: border-box;
			margin-top: 24rpx;

			view {
				width: 240rpx;
			}
		}
	}
</style>